{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "pycharm": {
     "is_executing": true
    }
   },
   "outputs": [],
   "source": [
    "import cv2\n",
    "import re\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "import csv\n",
    "try:\n",
    "    from PIL import Image\n",
    "except ImportError:\n",
    "    import Image\n",
    "import pytesseract\n",
    "import xlsxwriter\n",
    "import keyboard\n",
    "# Path to Tesseract.exe\n",
    "pytesseract.pytesseract.tesseract_cmd = r''"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAD8CAYAAACINTRsAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAty0lEQVR4nO3de3RU53nv8e8zN2kkzWik0V3ICCFAQTL3m4DaiYH4xq12guN6HRMHL7oSd9U57nJin9arTZt0Ya+upE2a2vU5zqmbxnFMHGOb2AbsCHwpGAMm5iojhBASQkgCCV2ZkeY9f2hrjsBgBLqM2H4+a+01e7+z9zvv+2rPT3v2XLYYY1BKKWUPjlg3QCml1NDRUFdKKRvRUFdKKRvRUFdKKRvRUFdKKRvRUFdKKRsZllAXkdtEpFxEKkTkseF4DKWUUp8lQ/05dRFxAp8CS4Aa4CPgXmPMwSF9IKWUUp8xHEfqc4AKY0ylMSYEvAisGIbHUUopdRHXMNSZC5zot1wDzP28DUREv9aqlFJXwRgjlyofjlAfEBFZC6yN1eMrpZQdDUeo1wJ5/ZbHWGUXMMY8CzwLeqSulFJDZTjOqX8ETBCRcSLiAb4BvDYMj6OUUuoiQ36kbozpFpG/ADYBTuAXxpgDQ/04SimlPmvIP9J4TY3Q0y9KKXVVLvdGqX6jVCmlbERDXSmlbERDXSmlbERDXSmlb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7rR9ez8wSMoTeQbgE2AkLvl0NcF+9TwCag1Jp3WetJrPswAmOUDBy7uK+6L31mnHKBE0CqtX9sBG693venWJ9+6RvUPjVW2Rea9bJuOvAhkGmMqbPuOgVkWvNf1LH7Z+B7QMRaDgLNxphua7n/OETHyLq/xVrf7sYBDcD/tU5T/R8RSUT3pQsYY2qBfwKqgTp694/dXOf7U6xDXV1ERJKAl4HvGmPO9b/P9B4ifGE/riQiS4HTxpjdsW7LKOcCZgBPG2OmA+38/1MtgO5LANZ7Civo/SeYAyQCt8W0UUMg1qFeC+T1Wx5jlX0hiYib3kD/lTHmd1ZxvYhkW/dnA6et8i/i2C0AlotIFfAivadg/gUIiEjfT170H4foGFn3JwNNI9ngGKkBaowxH1rLv6U35HVfutBi4JgxpsEYEwZ+R+8+dl3vT7EO9Y+ACda7zR5636R4LcZtigkREeA54JAx5sf97noNWG3Nr6b3XHtf+f3WJxfmAS39XlrbkjHmcWPMGGNMPr37yh+MMfcBZcDXrNUuHqO+sfuatb7tj06NMaeAEyIyySpaBBxE96WLVQPzRCTBev71jdP1vT/F+qQ+cAfwKXAU+OtYtyeG47CQ3pfDnwB7rekOes/ZvQMcAd4GUq31hd5PDh0F9tH7Dn7M+zGC4/VlYKM1XwDsBCqA9UCcVR5vLVdY9xfEut0jOD7TgF3W/rQBSNF96ZLj9APgMLAf+CUQd73vT/qNUqWUspFYn35RSik1hDTUlVLKRjTUlVLKRjTUlVLKRjTUlVLKRjTUlVLKRjTUlVLKRjTUlVLKRv4fhH7MUtnXH40AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#read your file\n",
    "file=r''\n",
    "img = cv2.imread(file,0)\n",
    "img.shape\n",
    "#thresholding the image to a binary image\n",
    "thresh,img_bin = cv2.threshold(img,128,255,cv2.THRESH_BINARY |cv2.THRESH_OTSU)\n",
    "#inverting the image \n",
    "img_bin = 255-img_bin\n",
    "cv2.imwrite('test1_inv.png',img_bin)\n",
    "#Plotting the image to see the output\n",
    "plotting = plt.imshow(img_bin,cmap='gray')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Length(width) of kernel as 100th of total width\n",
    "kernel_len = np.array(img).shape[1]//100\n",
    "# Defining a vertical kernel to detect all vertical lines of image \n",
    "ver_kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (1, kernel_len))\n",
    "# Defining a horizontal kernel to detect all horizontal lines of image\n",
    "hor_kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (kernel_len, 1))\n",
    "# A kernel of 2x2\n",
    "kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (2, 2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAD8CAYAAACINTRsAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAty0lEQVR4nO3de3RU53nv8e8zN2kkzWik0V3ICCFAQTL3m4DaiYH4xq12guN6HRMHL7oSd9U57nJin9arTZt0Ya+upE2a2vU5zqmbxnFMHGOb2AbsCHwpGAMm5iojhBASQkgCCV2ZkeY9f2hrjsBgBLqM2H4+a+01e7+z9zvv+2rPT3v2XLYYY1BKKWUPjlg3QCml1NDRUFdKKRvRUFdKKRvRUFdKKRvRUFdKKRvRUFdKKRsZllAXkdtEpFxEKkTkseF4DKWUUp8lQ/05dRFxAp8CS4Aa4CPgXmPMwSF9IKWUUp8xHEfqc4AKY0ylMSYEvAisGIbHUUopdRHXMNSZC5zot1wDzP28DUREv9aqlFJXwRgjlyofjlAfEBFZ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MAx6yxuIx4B1jzATgHWsZesdsgjWtBZ4e+SbHzMPAoX7LTwI/McYUAmeBNVb5GuCsVf4Ta70vin8B3jLGFAFT6R0v3Zf6EZFc4C+BWcaYEsAJfIPrfX8yxsRsAkqBTf2WHwcej2WbRssEvAosofdLWdlWWTa9n+kH+Hfg3n7rR9ez8wSMoTeQbgE2AkLvl0NcF+9TwCag1Jp3WetJrPswAmOUDBy7uK+6L31mnHKBE0CqtX9sBG693venWJ9+6RvUPjVW2Rea9bJuOvAhkGmMqbPuOgVkWvNf1LH7Z+B7QMRaDgLNxphua7n/OETHyLq/xVrf7sYBDcD/tU5T/R8RSUT3pQsYY2qBfwKqgTp694/dXOf7U6xDXV1ERJKAl4HvGmPO9b/P9B4ifGE/riQiS4HTxpjdsW7LKOcCZgBPG2OmA+38/1MtgO5LANZ7Civo/SeYAyQCt8W0UUMg1qFeC+T1Wx5jlX0hiYib3kD/lTHmd1ZxvYhkW/dnA6et8i/i2C0AlotIFfAivadg/gUIiEjfT170H4foGFn3JwNNI9ngGKkBaowxH1rLv6U35HVfutBi4JgxpsEYEwZ+R+8+dl3vT7EO9Y+ACda7zR5636R4LcZtigkREeA54JAx5sf97noNWG3Nr6b3XHtf+f3WJxfmAS39XlrbkjHmcWPMGGNMPr37yh+MMfcBZcDXrNUuHqO+sfuatb7tj06NMaeAEyIyySpaBBxE96WLVQPzRCTBev71jdP1vT/F+qQ+cAfwKXAU+OtYtyeG47CQ3pfDnwB7rekOes/ZvQMcAd4GUq31hd5PDh0F9tH7Dn7M+zGC4/VlYKM1XwDsBCqA9UCcVR5vLVdY9xfEut0jOD7TgF3W/rQBSNF96ZLj9APgMLAf+CUQd73vT/qNUqWUspFYn35RSik1hDTUlVLKRjTUlVLKRjTUlVLKRjTUlVLKRjTUlVLKRjTUlVLKRjTUlVLKRv4fhH7MUtnXH40AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#read your file\n",
    "file=r''\n",
    "img = cv2.imread(file,0)\n",
    "img.shape\n",
    "#thresholding the image to a binary image\n",
    "thresh,img_bin = cv2.threshold(img,128,255,cv2.THRESH_BINARY |cv2.THRESH_OTSU)\n",
    "#inverting the image \n",
    "img_bin = 255-img_bin\n",
    "cv2.imwrite('test_inv.png',img_bin)\n",
    "#Plotting the image to see the output\n",
    "plotting = plt.imshow(img_bin,cmap='gray')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Length(width) of kernel as 100th of total width\n",
    "kernel_len = np.array(img).shape[1]//100\n",
    "# Defining a vertical kernel to detect all vertical lines of image \n",
    "ver_kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (1, kernel_len))\n",
    "# Defining a horizontal kernel to detect all horizontal lines of image\n",
    "hor_kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (kernel_len, 1))\n",
    "# A kernel of 2x2\n",
    "kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (2, 2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAD8CAYAAACINTRsAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAPs0lEQVR4nO3dW4yc5X3H8e/PdowhHGwTWLm2U4hiNUKVAsiiRslFCk0LNIq5IBEoKlZkyTdUJSRSCu1FFakXiVSFBKlCtSDUidIklBywyKlgiKpehLA0QDizIQfbApwSQ0oTjv73Yh6TwQd2bO961o+/H2k0z2lmnnn0zm9fP/vOOlWFJKkP88Y9AUnSzDHUJakjhrokdcRQl6SOGOqS1BFDXZI6MiuhnuSCJI8lmUpy9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V27ArcD7GXwpa1lrW8bgmn6AfwEuGxr/+rieb8AKBoF0HnAbEAZfDlmw5zEFfB84t5UXtHEZ93s4DGt0EvCzPd+rx9Je67Qc2AosbcfHbcBfHOnH07i3X3Yv6m7bWttRrf2z7izgbmCiqp5qXU8DE618tK7d54BPArta/WTguap6tdWH1+H1NWr9z7fxvTsd+BVwU9umuiHJW/FYeoOq2g78E/BL4CkGx8e9HOHH07hDXXtIcjzwdeBjVfWb4b4anCIctZcrJfkAsKOq7h33XOa4BcDZwPVVdRbwf/x+qwXwWAJov1NYy+CH4B8AbwUuGOukZsC4Q307sHKovqK1HZWSvIVBoH+5qr7Rmp9Jsqz1LwN2tPajce3eA3wwyc+BrzLYgvk8sDjJ7j95MbwOr69R6z8JePZwTnhMtgHbquruVr+FQch7LL3RnwE/q6pfVdUrwDcYHGNH9PE07lC/B1jVftu8kMEvKTaPeU5jkSTAjcAjVfXZoa7NwLpWXsdgr313++XtyoU1wPND/7TuUlVdU1Urquo0BsfKnVX1EeAu4JI2bM812r12l7Tx3Z+dVtXTwNYkf9SazgcexmNpT78E1iQ5rn3+dq/TkX08jXtTH7gIeBz4KfD3457PGNfhvQz+OfwAcF+7XcRgz24L8ARwB7C0jQ+DK4d+CvyEwW/wx/4+DuN6vQ+4rZXfAfwImAL+HTimtS9q9anW/45xz/swrs+ZwGQ7nr4FLPFY2uc6fQp4FHgQ+BJwzJF+PPmNUknqyLi3XyRJM8hQl6SOGOqS1BFDXZI6YqhLUkcMdUnqiKEuSR0x1CWpI/8PpEZvLxQ0u5YAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#Use vertical kernel to detect and save the vertical lines in a jpg\n",
    "image_1 = cv2.erode(img_bin, ver_kernel, iterations=3)\n",
    "vertical_lines = cv2.dilate(image_1, ver_kernel, iterations=3)\n",
    "cv2.imwrite(\"image_vertical.jpg\",vertical_lines)\n",
    "#Plot the generated image\n",
    "plotting = plt.imshow(image_1,cmap='gray')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAD8CAYAAACINTRsAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAP3UlEQVR4nO3df8ydZX3H8fdnrS1TJwV0XdeWFUMz0yxMoGEQ/cPpnPwwFg2RGjca06TJAgGniQP2h9v+M1msEg2jETcwTgT8QVM2WSkkToOMMg0iP4uibQNU5YdzKt1Dv/vjXK2Ppe1znvY5Pe3V9ys5Ofd13de57+tcuft57l7nPvdJVSFJ6sNvjbsDkqSZY6hLUkcMdUnqiKEuSR0x1CWpI4a6JHVkJKGe5NwkjybZkuTKUexDkvRymenr1JPMAh4D3g5sA+4D3ldVD83ojiRJLzOKM/WzgC1V9f2q2gncBKwYwX4kSXuZPYJtLgS2TipvA/7kQC9I4tdaJWkaqir7qh9FqA8lyRpgzbj2L0k9GkWobwcWTyovanW/oarWAevAM3VJmimjmFO/D1ia5JQkc4CVwPoR7EeStJcZP1OvqokklwF3ALOAz1bV92Z6P5Kkl5vxSxoPqhNOv0jStOzvg1K/USpJHTHUJakjhrokdcRQl6SOGOqS1BFDXZI6YqhLUkcMdUnqiKEuSR0x1CWpI2O79e7hcNZZZ3HGGWeMuxuStMcTTzzBxo0bR7b9rkN9xYoVXH311ePuhiTtccsttxjqB+v2229nx44d4+6GJO3x2GOPjXT73qVRko5C3qVRko4BhrokdcRQl6SOGOqS1BFDXZI6YqhLUkcMdUnqiKEuSR0x1CWpI4a6JHXEUJekjhjqktQRQ12SOmKoS1JHpgz1JJ9NsiPJg5PqTkyyMcnj7fmEVp8k1yTZkuSBJP7skCQdR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hD/T5gafu0eQ6DDynWj7lPY5EkwPXAw1X18Umr1gOr2vIqBnPtu+svaVcunA28MOm/1l2qqquqalFVLWFwrNxVVe8H7gYuas32HqPdY3dRa9/92WlVPQ1sTfKHreptwEN4LO3tR8DZSV7Z/v3tHqej+3ga96Q+cD7wGPAE8Lfj7s8Yx+HNDP47/ADwnfY4n8Gc3SbgceBO4MTWPgyuHHoC+C6DT/DH/j4O43i9BdjQll8P/BewBbgFmNvqj2vlLW3968fd78M4Pm8ENrfj6avACR5L+xynvwceAR4EPgfMPdqPJ79RKkkdGff0iyRpBhnqktQRQ12SOmKoS1JHDHVJ6oihLkkdMdQlqSOGuiR15P8BiLPE7Y9g2IkAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#Use horizontal kernel to detect and save the horizontal lines in a jpg\n",
    "image_2 = cv2.erode(img_bin, hor_kernel, iterations=3)\n",
    "horizontal_lines = cv2.dilate(image_2, hor_kernel, iterations=3)\n",
    "cv2.imwrite(\"test_horizontal.jpg\",horizontal_lines)\n",
    "#Plot the generated image\n",
    "plotting = plt.imshow(image_2,cmap='gray')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAD8CAYAAACINTRsAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAuNElEQVR4nO3deXwVZZ7v8c/vbFnOOZANkgBJCJBAVCSsgiyy2iwKtoritW2mx26cGbuxb2u32srrNXe8PbbTo321veMM03ZfXHAZRQFFQEBQQZCgKAIia0iArCSBbGR77h+pZEJECHCSSsrf+/Wq16l6qk6d53nynG/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+0EGsf0hnzbflVErrbVr8c/teaGrrudrcet25tvk+nK66lHafaxw5va/ONV5a90FbtmndT1253/S3X5RSykE01JVSykE01JVSykE01JVSykE01JVSykE01JVSykE01JVSykE01JVSykE01JVSykE01JVSykE01JVSykE01JVSykE01JVSykE01JVSykE01JVSykE01JVSykE01JVSyknsvpRdqC9nFwgEzIQJEzrsUlRdeXK73Wb69Om2XO6sK06TJ082kZGRttejK0zBYNCMHz/e9np0hSnUl7OTznAZNStUQsbj0av0XUh9fX3j9Qy1ry6ooaGBhoYG3G43ImJ3dTq9uro6QJ+HbVFfX4/f72fdunWMGzeuue/awhhzzsHouF7v27cvK1eupKKiwu6qdGr33XcfX375JevXr8fl0rNw57N48WL+8pe/sGTJEgYOHEh9fb3dVeq0Kisrue222+jWrRsrVqygvLzc7ip1WsYYfvGLX/D111+HdL+OC/WIiAiOHTvGrbfeandVOrWqqirCw8PxeDzMmDGDM2fO2F2lTqupbxITE/nbv/1bDh8+bHONOi9jDJWVlSQmJnL06FFuu+02u6vUqVVWVhIZGRnSfTou1AFqa2v1CKGNGhoaOHXqFLW1tXZXpdMzxnDq1CkdW22kz0N76OtupZRyEA11pZRyEA11pZRyEA11pZRykAuGuogkicgHIrJHRHaLyH1WeYyIvC8i+63baKtcROQZETkgIl+KyLD2boRSSqlGbTlSrwPuN8ZcAYwG7hWRK4CHgPXGmDRgvbUMMANIs6YFwHMhr7VSSqlzumCoG2NOGGM+s+ZPA3uB3sAcYIm12RLgJmt+DvCCabQViBKRxFBXXCml1Ldd1Dl1EekLDAW2AfHGmBPWqjwg3prvDeS0uFuuVdZ6XwtEJEtEsi620koppc6tzaEuIgHgTeCXxphTLdeZxh+QuajfbzHGLDbGjDDGjLiY+ymllPpubQp1EfHSGOgvG2OWWcX5TadVrNsCq/wYkNTi7n2sMqWUUu2sLZ9+EeB5YK8x5qkWq1YA8635+cDyFuU/tj4FMxooa3GaRimlVDtqy2+/jAXuAnaJyE6r7LfA74HXReRuIBto+uWeVcBM4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kr169SE1NxeVy0b9/f3r27Mn8+fOZOnUq9fX1TJw4kZKSEm644QbGjh3LXXfdRWpqKnfddRcApaWl/Nd//Re1tbU0NDTwyiuvkJmZyUMPPYTL1fUisuvVuJN5/fXXGTFiBH6/n1mzZlFSUoIxBp/PR35+PgUFBRw9epSysjLCw8MxxrBp0yaeffZZ6urqEBF+9KMfATjmCOq7VFZWsnz5cqZPn04gEGDSpEkcPHiQYDBIbW0tBw8eJD8/n4MHD2KMITIykpycHF566SU2bNjQvJ958+bx7rvvUl9fb2Nr2s/q1avp1asXiYmJTJ06laqqKurq6vB6vZw4cYJjx45x7NgxiouLm8dUVlYWTz75JFVVVQB4PB7cbjder5eCggJSUlKIj4/n+PHjNrcutGpra3nhhReYPXs2fr+f6667jkOHDhEIBKivr+fgwYMUFxezb98+6urqiIyMJC8vj2XLlvH222837ycsLAyPx4PH42H37t28++67xMTE0PiF+q5FT79cooaGBjZt2kRxcTG///3vSUpKYs+ePUybNo0PPviAQ4cOYYwhOzubgoLGn8U5deoU+fn5XHfddWzZsgVjDF6vl8TERKqrq5k+ffpZA81JCgsL2bp1K5s2bWLx4sXs37+fTz75hGAw2HzKoKSkhA8//JDy8nI2bNjAe++9x5133smwYcN48803AXC73eTm5vLRRx/Z3KL28cknn1BcXMwTTzzB+PHj2bhxI7Nnz2bz5s0cPXqULVu2kJOTg8fjoaCgAL/fz+eff8748ePZvXt386mGSZMmUVxczNSpU1m6dCm33XYbpaWlbNy40e4mhkx5eTkff/wxX375JU8//TQ7d+5EROjRowcfffQRp06d4tixY2zevJnS0lI2bdrE5s2biYuLY8yYMbz11lsABINBxo0bhzGGAQMGMGzYMKKionj66ae75oGDMcb2icZfeAzJlJGRYVauXBmy/Tl58vv9ZuvWrcbr9dpel64wrVu3zqSkpNhej64wDR482Cxfvtz2enSFKRAImK1btxqPx3NR9/uuPNXTL0op5SAa6kop5SAa6kop5SAa6kop5SAa6kop5SAa6kop5SAa6kop5SAa6kop5SAa6kop5SAa6kop5SA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ODxtOnqgl2Sx+MhISEBESEQCFxWW7t3707fvn3x+XwhrGHnEB0dTSAQQETo3r37Ze2rZ8+eiAjQeMm0yMjIUFSx03C5XCQkJOByuYiMjLys8RAeHk5UVFTzclRUFH6/PwS17Hga6pfI5XLxpz/9id/85jckJSVx33334XK5iIqKIiIionmgRUVFER4e3vwE9Xg8REdHN4eay+Xi+uuv5/bbb2f+/Pnne8gurV+/fqxevZorr7ySu+++m4yMDHw+H9HR0bhcLnw+H8FgkMjISILBIOHh4UDjdVRbhlt8fDz3338/mZmZjgspgN/+9rc8+eSTxMbG8uCDDzaHe2RkJCLyrTElIrhcLqKjo88Ktdtvv5233noLv99Pr169WLp0KXPnOusXsePi4li1ahUTJ07k5ptvZsKECXi9XqKjo3G73fh8PgKBAH6/n0AgQEREBAARERFERUU1/8MLBoM8+eST3H///UBjoD/77LPcddddtrXtcjj30LCdiQiFhYX06tWLzMxMwsLCSE9PZ/LkyfTq1YvXXnuNhQsXUlRUhMfjwe1285//+Z9MmzYNj8eDy+XiqaeeoqGhgS1btpCUlERDQ4PdzWo3brebHTt2MH/+fIqLiwkLC2POnDkMHDiQvXv3kpaWRkNDA5mZmWRlZRETE8Of//xn5s+fj8fjYeXKlXz66adMnjyZHj16MGjQILZv305paandTQupyspKAoEAkyZNIiwsjJSUFGbMmEFqaip/+ctfePTRRzl48CDBYJDa2lqWLVvG4MGD8fv9xMbG8thjj1FbW8vatWsZP348IkJRURFLly5t/kfpFCLCF198wS233MJXX31FSUkJN954I+np6eTm5hIbG0tUVBTJycl88803REdH88wzz/DTn/4UYwxffPEFK1asoLKykhdffJEpU6YgItx6661s374dt9ttdxMviR6pX4a6ujpefvll5s2bh8fjYeDAgURFRXH11VcTGxvL/v372bhxI19//TW7du1i6NChTJkyhZqaGqqqqnC5Gru/traW7Oxs+vXrZ3OL2tehQ4coKipizJgxeDwerrjiCsLCwrjyyisJCwvjjTfe4MSJE7zyyivExMQwceJEevbsSVlZWfMrG5/Px8cff8xXX33FzJk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+Ar4GvgBeBsK4+nvQbpUop5SB2n35RSikVQhrqSinlIBrqSinlIBrqSinlIBrqSinlIBrqSinlIBrqSinlIBrqSinlIP8fHMYnIcKQMk8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Combine horizontal and vertical lines in a new third image, with both having same weight.\n",
    "img_vh = cv2.addWeighted(vertical_lines, 0.5, horizontal_lines, 0.5, 0.0)\n",
    "#Eroding and thesholding the image\n",
    "img_vh = cv2.erode(~img_vh, kernel, iterations=2)\n",
    "thresh, img_vh = cv2.threshold(img_vh,128,255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)\n",
    "cv2.imwrite(\"test_grid.jpg\", img_vh)\n",
    "bitxor = cv2.bitwise_xor(img,img_vh)\n",
    "bitnot = cv2.bitwise_not(bitxor)\n",
    "#Plotting the generated image\n",
    "plotting = plt.imshow(bitnot,cmap='Greys')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Detect contours for following box detection\n",
    "contours, hierarchy = cv2.findContours(img_vh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "def sort_contours(cnts, method=\"left-to-right\"):\n",
    "    # initialize the reverse flag and sort index\n",
    "    reverse = False\n",
    "    i = 0\n",
    "    # handle if we need to sort in reverse\n",
    "    if method == 'right-to-left' or method == 'bottom-to-top':\n",
    "        reverse = True\n",
    "    # handle if we are sorting against the y-coordinate rather than\n",
    "    # the x-coordinate of the bounding box\n",
    "    if method == 'top-to-bottom' or method == 'bottom-to-top':\n",
    "        i = 1\n",
    "    # construct the list of bounding boxes and sort them from top to\n",
    "    # bottom\n",
    "        boundingBoxes = [cv2.boundingRect(c) for c in cnts]\n",
    "    (cnts, boundingBoxes) = zip(*sorted(zip(cnts, boundingBoxes),\n",
    "        key=lambda b:b[1][i], reverse=reverse))\n",
    "    # return the list of sorted contours and bounding boxes\n",
    "    return (cnts, boundingBoxes)\n",
    "\n",
    "# Sort all the contours by top to bottom.\n",
    "contours, boundingBoxes = sort_contours(contours, method='top-to-bottom')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Creating a list of heights for all detected boxes\n",
    "heights = [boundingBoxes[i][3] for i in range(len(boundingBoxes))]\n",
    "#Get mean of heights\n",
    "mean = np.mean(heights)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAD8CAYAAACINTRsAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAx00lEQVR4nO3de3xU5b34+88ztyRzIZMLuZALBEggCiZcRRHk6gUUWpWCx1p2ty2+um3j72B3a1t9nX12z961213709p6SrUetVXbrVJpq6BClIpUAe9yTYAQLrkNISHXmWS+549M0hBAAiTMsPy+X6/1mrWeWbPm+zx51ndWnrk8RkRQSillDbZoB6CUUmrgaFJXSikL0aSulFIWokldKaUsRJO6UkpZiCZ1pZSykEFJ6saY64wxu4wxZcaYewfjOZRSSp3MDPTn1I0xdmA3MB84CGwBbhWR7QP6REoppU4yGFfqU4EyEdkrIkHgeWDxIDyPUkqpPhyDcMwsoLLX9kHg8s97gDFGv9aqlFJnQUTMqcoHI6n3izFmBbAiWs+vlFJWNBhJ/RCQ02s7O1J2AhFZBawCvVJXSqmBMhhj6luAfGNMnjHGBSwD1gzC8yillOpjwK/URaTDGPNtYB1gB34rIp8N9PMopZQ62YB/pPGcgtDhF6WUOiune6NUv1GqlFIWokld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86ZTv938BO4FPgGSDuYu9P+o1SpZSykGgPvyillBpAmtSVUspCNKkrpZSFaFJXSikL0aSulFIWokldKaUsRJO6UkpZiCZ1pZSykP8fAjqNhYQoN48AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#Create list box to store all boxes in  \n",
    "box = []\n",
    "# Get position (x,y), width and height for every contour and show the contour on image\n",
    "for c in contours:\n",
    "    x, y, w, h = cv2.boundingRect(c)\n",
    "    if (w<1000 and h<500):\n",
    "        image = cv2.rectangle(img,(x,y),(x+w,y+h),(0,255,0),2)\n",
    "        box.append([x,y,w,h])\n",
    "plotting = plt.imshow(image,cmap=\"Greys\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[669, 429, 197, 117], [464, 429, 198, 117], [260, 429, 197, 117], [56, 429, 197, 117]]\n",
      "[[[669, 52, 197, 117], [464, 52, 198, 117], [260, 52, 197, 117], [56, 52, 197, 117]], [[669, 176, 197, 117], [464, 176, 198, 117], [260, 176, 197, 117], [56, 176, 197, 117]], [[669, 300, 197, 122], [464, 300, 198, 122], [260, 300, 197, 122], [56, 300, 197, 122]], [[669, 429, 197, 117], [464, 429, 198, 117], [260, 429, 197, 117], [56, 429, 197, 117]]]\n"
     ]
    }
   ],
   "source": [
    "#Creating two lists to define row and column in which cell is located\n",
    "row=[]\n",
    "column=[]\n",
    "j=0\n",
    "#Sorting the boxes to their respective row and column\n",
    "for i in range(len(box)):\n",
    "    if(i==0):\n",
    "        column.append(box[i])\n",
    "        previous=box[i]\n",
    "    else:\n",
    "        if(box[i][1]<=previous[1]+mean/2):\n",
    "            column.append(box[i])\n",
    "            previous=box[i]\n",
    "            if(i==len(box)-1):\n",
    "                row.append(column)\n",
    "        else:\n",
    "            row.append(column)\n",
    "            column=[]\n",
    "            previous = box[i]\n",
    "            column.append(box[i])\n",
    "print(column)\n",
    "print(row)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "#calculating maximum number of cells\n",
    "countcol = 0\n",
    "for i in range(len(row)):\n",
    "    countcol = len(row[i])\n",
    "    if countcol > countcol:\n",
    "        countcol = countcol"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Retrieving the center of each column\n",
    "center = [int(row[i][j][0]+row[i][j][2]/2) for j in range(len(row[i])) if row[0]]\n",
    "center=np.array(center)\n",
    "center.sort()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Regarding the distance to the columns center, the boxes are arranged in respective order\n",
    "finalboxes = []\n",
    "for i in range(len(row)):\n",
    "    lis=[]\n",
    "    for k in range(countcol):\n",
    "        lis.append([])\n",
    "    for j in range(len(row[i])):\n",
    "        diff = abs(center-(row[i][j][0]+row[i][j][2]/4))\n",
    "        minimum = min(diff)\n",
    "        indexing = list(diff).index(minimum)\n",
    "        lis[indexing].append(row[i][j])\n",
    "    finalboxes.append(lis)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "#from every single image-based cell/box the strings are extracted via pytesseract and stored in a list\n",
    "outer=[]\n",
    "for i in range(len(finalboxes)):\n",
    "    for j in range(len(finalboxes[i])):\n",
    "        inner=''\n",
    "        if(len(finalboxes[i][j])==0):\n",
    "            outer.append(' ')\n",
    "        else:\n",
    "            for k in range(len(finalboxes[i][j])):\n",
    "                y,x,w,h = finalboxes[i][j][k][0],finalboxes[i][j][k][1], finalboxes[i][j][k][2],finalboxes[i][j][k][3]\n",
    "                finalimg = bitnot[x:x+h, y:y+w]\n",
    "                kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (2, 1))\n",
    "                border = cv2.copyMakeBorder(finalimg,2,2,2,2,   cv2.BORDER_CONSTANT,value=[255,255])\n",
    "                resizing = cv2.resize(border, None, fx=2, fy=2, interpolation=cv2.INTER_CUBIC)\n",
    "                dilation = cv2.dilate(resizing, kernel,iterations=1)\n",
    "                erosion = cv2.erode(dilation, kernel,iterations=1)\n",
    "\n",
    "                \n",
    "                out = pytesseract.image_to_string(erosion)\n",
    "                if(len(out)==0):\n",
    "                    out = pytesseract.image_to_string(erosion, config='--psm 3')\n",
    "                inner = inner +\" \"+ out\n",
    "            outer.append(inner)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "            0           1            2            3\n",
      "0   Name 1\\n\f",
      "   Name 8\\n\f",
      "    Name 9\\n\f",
      "   Name 16\\n\f",
      "\n",
      "1   Name 2\\n\f",
      "   Name 7\\n\f",
      "   Name 10\\n\f",
      "   Name 15\\n\f",
      "\n",
      "2   Name 3\\n\f",
      "   Name 6\\n\f",
      "   Name 11\\n\f",
      "   Name 14\\n\f",
      "\n",
      "3   Name 4\\n\f",
      "   Name 5\\n\f",
      "   Name 12\\n\f",
      "   Name 13\\n\f",
      "\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "c:\\users\\asus\\rotten-scripts\\lib\\site-packages\\pandas\\io\\formats\\css.py:261: CSSWarning: Ill-formatted attribute: expected a colon in ' Name 1\\n'\n",
      "  warnings.warn(\n",
      "c:\\users\\asus\\rotten-scripts\\lib\\site-packages\\pandas\\io\\formats\\css.py:261: CSSWarning: Ill-formatted attribute: expected a colon in ' Name 2\\n'\n",
      "  warnings.warn(\n",
      "c:\\users\\asus\\rotten-scripts\\lib\\site-packages\\pandas\\io\\formats\\css.py:261: CSSWarning: Ill-formatted attribute: expected a colon in ' Name 3\\n'\n",
      "  warnings.warn(\n",
      "c:\\users\\asus\\rotten-scripts\\lib\\site-packages\\pandas\\io\\formats\\css.py:261: CSSWarning: Ill-formatted attribute: expected a colon in ' Name 4\\n'\n",
      "  warnings.warn(\n",
      "c:\\users\\asus\\rotten-scripts\\lib\\site-packages\\pandas\\io\\formats\\css.py:261: CSSWarning: Ill-formatted attribute: expected a colon in ' Name 8\\n'\n",
      "  warnings.warn(\n",
      "c:\\users\\asus\\rotten-scripts\\lib\\site-packages\\pandas\\io\\formats\\css.py:261: CSSWarning: Ill-formatted attribute: expected a colon in ' Name 7\\n'\n",
      "  warnings.warn(\n",
      "c:\\users\\asus\\rotten-scripts\\lib\\site-packages\\pandas\\io\\formats\\css.py:261: CSSWarning: Ill-formatted attribute: expected a colon in ' Name 6\\n'\n",
      "  warnings.warn(\n",
      "c:\\users\\asus\\rotten-scripts\\lib\\site-packages\\pandas\\io\\formats\\css.py:261: CSSWarning: Ill-formatted attribute: expected a colon in ' Name 5\\n'\n",
      "  warnings.warn(\n",
      "c:\\users\\asus\\rotten-scripts\\lib\\site-packages\\pandas\\io\\formats\\css.py:261: CSSWarning: Ill-formatted attribute: expected a colon in ' Name 9\\n'\n",
      "  warnings.warn(\n",
      "c:\\users\\asus\\rotten-scripts\\lib\\site-packages\\pandas\\io\\formats\\css.py:261: CSSWarning: Ill-formatted attribute: expected a colon in ' Name 10\\n'\n",
      "  warnings.warn(\n",
      "c:\\users\\asus\\rotten-scripts\\lib\\site-packages\\pandas\\io\\formats\\css.py:261: CSSWarning: Ill-formatted attribute: expected a colon in ' Name 11\\n'\n",
      "  warnings.warn(\n",
      "c:\\users\\asus\\rotten-scripts\\lib\\site-packages\\pandas\\io\\formats\\css.py:261: CSSWarning: Ill-formatted attribute: expected a colon in ' Name 12\\n'\n",
      "  warnings.warn(\n",
      "c:\\users\\asus\\rotten-scripts\\lib\\site-packages\\pandas\\io\\formats\\css.py:261: CSSWarning: Ill-formatted attribute: expected a colon in ' Name 16\\n'\n",
      "  warnings.warn(\n",
      "c:\\users\\asus\\rotten-scripts\\lib\\site-packages\\pandas\\io\\formats\\css.py:261: CSSWarning: Ill-formatted attribute: expected a colon in ' Name 15\\n'\n",
      "  warnings.warn(\n",
      "c:\\users\\asus\\rotten-scripts\\lib\\site-packages\\pandas\\io\\formats\\css.py:261: CSSWarning: Ill-formatted attribute: expected a colon in ' Name 14\\n'\n",
      "  warnings.warn(\n",
      "c:\\users\\asus\\rotten-scripts\\lib\\site-packages\\pandas\\io\\formats\\css.py:261: CSSWarning: Ill-formatted attribute: expected a colon in ' Name 13\\n'\n",
      "  warnings.warn(\n"
     ]
    }
   ],
   "source": [
    "#Creating a dataframe of the generated OCR list\n",
    "arr = np.array(outer)\n",
    "dataframe = pd.DataFrame(arr.reshape(len(row), countcol))\n",
    "print(dataframe)\n",
    "print(\"Ready to Convert the Img File\\n Do you want a csv file or excel file?\\n \"\n",
    "      \"\\tPress [x] for Excel.\\n\"\n",
    "      \"\\tPress [c] for csv.\\n\")\n",
    "while True:\n",
    "    if keyboard.read_key() == \"x\":\n",
    "\n",
    "        data = dataframe.replace(r'\\n', '', regex=True)\n",
    "        data = data.style.set_properties(align=\"left\")\n",
    "        # Converting it in a excel-file\n",
    "        ILLEGAL_CHARACTERS_RE = re.compile(r'[\\000-\\010]|[\\013-\\014]|[\\016-\\037]')\n",
    "        data = data.applymap(lambda x: ILLEGAL_CHARACTERS_RE.sub(r'', x) if isinstance(x, str) else x)\n",
    "        # Converting it in a excel-file\n",
    "        print(data)\n",
    "        # Change the Path to the destination\n",
    "        writer = pd.ExcelWriter(file+'excel.xlsx',\n",
    "                                engine='xlsxwriter',\n",
    "                                options={'strings_to_numbers': True},\n",
    "                                )\n",
    "        data.to_excel(writer, encoding=\"utf-8\")\n",
    "        writer.save()\n",
    "        print(\"Thank You\\n\")\n",
    "        break\n",
    "    elif keyboard.read_key() == \"c\":\n",
    "        data = dataframe.replace(r'\\n', '', regex=True)\n",
    "        # Converting it in a excel-file\n",
    "        ILLEGAL_CHARACTERS_RE = re.compile(r'[\\000-\\010]|[\\013-\\014]|[\\016-\\037]')\n",
    "        data = data.applymap(lambda x: ILLEGAL_CHARACTERS_RE.sub(r'', x) if isinstance(x, str) else x)\n",
    "        # Converting it in a excel-file\n",
    "        print(data)\n",
    "        # Change the Path to the destination\n",
    "        data.to_csv(file+'csv.csv', encoding=\"utf-8\")\n",
    "        print(\"Thank You\\n\")\n",
    "        break\n",
    "    else:\n",
    "        print(\"Nothing!!!\\n\")\n",
    "        break"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}